import { createRouter, createWebHistory } from 'vue-router'
import homeView from '@/views/home/home.vue'
import detailView from '@/views/detail/index.vue'
import goodsView from '@/views/goods/index.vue'
import orderView from '@/views/order/index.vue'
import searchView from '@/views/search/index.vue'

import cartView from '@/views/home/cart.vue'
import claView from '@/views/home/cla.vue'
import indexView from '@/views/home/index.vue'
import myView from '@/views/home/my.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '', redirect: '/home/index' },

    {
      path: '/home', name: 'home', component: homeView, children: [
        { path: '/cart', name: 'cart', component: cartView, },
        { path: '/cla', name: 'cla', component: claView, },
        { path: '/index', name: 'index', component: indexView, },
        { path: '/my', name: 'my', component: myView, },
      ]
    },
    { path: '/detail', name: 'detail', component: detailView, },
    { path: '/goods', name: 'goods', component: goodsView, },
    { path: '/order', name: 'order', component: orderView, },
    { path: '/search', name: 'search', component: searchView, },

  ],
})

export default router
